package com.aiyan.edu.service.learning.client.fallback;

import com.aiyan.edu.service.learning.client.HelloSearchClient;
import feign.hystrix.FallbackFactory;
import org.hibernate.annotations.Cache;
import org.springframework.stereotype.Component;

/**
 * @author: zqzhou
 * @create: 2019/12/02 14:05
 **/
@Component
public class HelloSearchClientFallbackFactory implements FallbackFactory<HelloSearchClient> {
    @Override
    public HelloSearchClient create(Throwable throwable) {
        return new HelloSearchClient() {
            @Override
            public String data(String id) {
                System.err.println("回退原因：" + throwable);
                return "server error.";
            }
        };
    }
}
